import { getMenusApi } from '@/deps/api'
import { sessionStorage } from '@/deps/utils'
import { get } from 'lodash'
let menus = []
export let nowMenu = []
export const getMenus = async () => {
  if (menus.length > 0) {
    return menus
  }
  const userData = sessionStorage('userData')
  menus = await getMenusApi({
    userName: userData.userName,
    webmoduleId: 30
  })
  return menus
}

export const getMenu = async (menuid) => {
  await getMenus()
  const menu = menus.find(i => `${i.id}` === `${menuid}`)
  return menu
}
